package com.study.service.Impl;

import com.study.enums.ResultCodeEnum;
import com.study.exception.MyException;
import com.study.mapper.LinkMapper;
import com.study.service.LinkService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class LinkServiceImpl implements LinkService {
    @Autowired
    private LinkMapper linkMapper;

    @Override
    public void checkCode(String code) {
        if (linkMapper.checkCode(code) != 0) {
            throw new MyException(ResultCodeEnum.EXISTING_COUPLE);
        }
    }

    @Override
    public void link(Integer meId, Integer taId) {

        linkMapper.link(meId, taId);
    }
}
